HW 02

Author

Nathan Herling

Published

June 13, 2025

0 - Setup

[FYI]
'pacman' already installed — skipping install.
[FYI]
'dsbox' already installed — skipping GitHub install.
The packages loaded:
* tidyverse           * glue                * scales              * lubridate            
* patchwork           * ggh4x               * ggrepel             * openintro            
* ggridges            * dsbox               * janitor             * here                 
* knitr               * ggthemes            * ggplot2             * kableExtra           
* palmerpenguins                                                                         

1 - A new day, a new plot, a new geom

Question #1

A new day, a new plot, a new geom. The goal of this exercise is to learn about a new type of plot (ridgeline plot) and to learn how to make it. Use the geom_density_ridges() function from the ggridges package to make a ridge plot of Airbnb review scores of Edinburgh neighborhoods. The neighborhoods should be ordered by their median review scores. The data can be found in the dsbox package, and it’s called edibnb. Also include an interpretation for your visualization. You should review feedback from your Homework 1 to make sure you capture anything you may have missed previously.

Table 1. Diagnostic Summary for review_scores_rating (edibnb data set)
Metric Value
Data Type numeric
Min 20
1st Quartile 93
Median 97
Mean 95.0246657029274
3rd Quartile 99
Max 100
Missing Values 2177
IQR 6
Lower Outlier Bound 84
Upper Outlier Bound 108
Outlier Count 576
Picking joint bandwidth of 1.23


Interpretation
The graph (Distribution of Airbnb Review Scores by Edinburgh Neighborhood) displays the distribution of Airbnb review scores across Edinburgh neighborhoods using ridgeline plots, with each neighborhood’s mean score marked by a diamond. The mean review scores are generally high, ranging from about 93.9 to 95.9. Some neighborhoods, like Morningside and Bruntsfield, show slightly higher average scores. The variation in score spread highlights differences in review consistency between neighborhoods, making it easier to compare where listings tend to receive better feedback.

2 - Foreign Connected PACs

Question #2a


Contributions to US political parties from UK-connected PACs

Question #2b


Contributions to US political parties from Switzerland-connected PACs

3 - Median housing prices in the US

Question #3a


Put the question here

Question #3b


Put the question here

Warning: Removed 25 rows containing missing values or values outside the
scale range (`geom_rect()`).

4 - Expect More. Plot More.

Question #4


Recreate the Target LOGO.
Describe steps..
(see code comments)

5 - Mirror, mirror on the wall, who’s the ugliest of them all?

Question #5


Mirror, mirror on the wall, who’s the ugliest of them all? Make a plot of the variables in the penguins dataset from the palmerpenguins package. Your plot should use at least two variables, but more is fine too. First, make the plot using the default theme and color scales. Then, update the plot to be as ugly as possible. You will probably want to play around with theme options, colors, fonts, etc. The ultimate goal is the ugliest possible plot, and the sky is the limit!


Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':

    last_plot
The following object is masked from 'package:stats':

    filter
The following object is masked from 'package:graphics':

    layout
Warning: No trace type specified and no positional attributes
specified
No trace type specified:
  Based on info supplied, a 'scatter' trace seems appropriate.
  Read more about this trace type -> https://plotly.com/r/reference/#scatter
No scatter mode specifed:
  Setting the mode to markers
  Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode